import axios from 'axios'
import nprogress from 'nprogress'
import 'nprogress/nprogress.css'//引入进度条的样式文件,可以在他的css文件下修改进度条的颜色
console.log(nprogress)
const requests=axios.create({
  baseURL:'/mock',
  timeout:5000,
});
requests.interceptors.request.use((config)=>{
  nprogress.start()//进度条的开始
  console.log(config)
  return config;
})
requests.interceptors.response.use((res)=>{
  nprogress.done()//进度条的结束
  console.log(res)
  return res;
},(error)=>{
  return Promise.reject(new Error('faile'))
});
export default requests
